import { CustomI18NITF } from '@INTERFACES/Common'
import {
  TEMPLATE_STATUS_ENUM, TEMPLATE_TYPE_ENUM, DURATION_UNIT_ENUM, PACK_STATUS_ENUM,
  SERVICE_ITEMS_TYPE_ENUM
} from '@CONSTANTS/servicePack'
import { DoctorITF } from '@INTERFACES/Doctor'
import { PatientITF } from '@INTERFACES/Patient';
import { RouteParams } from '@NAVIGATION/navigateManager'

export interface ServiceItemsITF {
  SurveyTemplateId?: string;
  Title: CustomI18NITF;
  EntityId?: string;
  Name: string;
  Text: string;
  Type: SERVICE_ITEMS_TYPE_ENUM;
  UnitCost: number;
  Show: boolean;
  Quantity: number;
  ConsumedQuantity: number;
  Explain: string;
  ExpireDate: number;
}

export interface ServicePackITF {
  Template: TemplateITF,
  Patron: { // the user who bought the pack
      UserId: string;
      Name: CustomI18NITF;
      SearchName: string;
      UserName: string;
  },
  Patients: PatientITF[],
  Doctor: DoctorITF;
  ActivationDate: number;
  CreatedDate: number;
  ExpireDate: number;
  AdviceAdded: boolean;
  Status: PACK_STATUS_ENUM
  PackId: string;
  SurveyDate?: number;
  ServiceItem?: ServiceItemsITF;
  p8Id: string;
  AdviceFileName: string;
  Result: CustomI18NITF;
  ConditionInterpretation: CustomI18NITF;
  TreatmentAdvice: CustomI18NITF;
  PreventionAdvice: CustomI18NITF;
  AdviceSurveyId: string;
}

export interface MerchandiseOptionsITF {
  Days: number;
  Price: number;
  TemplateId: string;
}

export interface TemplateITF {
  Description: CustomI18NITF;
  DurationUnit: DURATION_UNIT_ENUM;
  ExpireDate: number,
  Price: number;
  ServiceItems: ServiceItemsITF[];
  Status: TEMPLATE_STATUS_ENUM;
  Title: CustomI18NITF;
  p8Id: string;
  Times: number;
  Type: TEMPLATE_TYPE_ENUM;
  LatestPack: ServicePackITF;
  Explain: string;
  BoughtPackId: string;
  PendingPackId: string;
  PendingOrderId: string;
  MerchandiseOptions: MerchandiseOptionsITF[];
  Days: number;
  DescriptionFileName?: string;
}

export interface ServiceItemsMapITF {
  [key: string]: {
    icon: string, bg: string,
    vipIcon: string,
    bgColor?: string,
    isPhone?: boolean,
    btnTextColor?: string
  }
}

export interface ServicePackRouterParamsITF extends RouteParams{
  pId: string;
  title: string;
}
export interface ServicePackMapMethodITF {
  isActive: boolean;
  isPaid: boolean;
  routerParams?: ServicePackRouterParamsITF
}
export type ServicePackMapITF = {
  [key in TEMPLATE_TYPE_ENUM]: {
    method: (params: ServicePackMapMethodITF) => void,
    shouldLogin?: boolean,
    verifyStatus?: (status : PACK_STATUS_ENUM)=> boolean
  };
};

export interface AdviceTitleMapITF {
  [key: string]: string
}
